<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	
	<xsl:template match="sqlTable">
		<table class="sqlTable" cellpadding="2">
			<thead><tr>
				<xsl:apply-templates select="head"/>
			</tr></thead>
			<xsl:if test="@empty=1">
				<tr class="dark">
					<td align="center" colspan="{count(head/column)}"><i><gt>table is empty</gt></i></td>
				</tr>
			</xsl:if>
			<xsl:apply-templates select="row"/>
		</table>
	</xsl:template>
	
	<xsl:template match="sqlTable/head/column">
		<th><xsl:apply-templates/></th>
	</xsl:template>

	<xsl:template match="sqlTable/row">
		<tr class="dark">
			<xsl:if test="position() mod 2 = 0">
				<xsl:attribute name="class">light</xsl:attribute>
			</xsl:if>
			<xsl:apply-templates/>
		</tr>
	</xsl:template>
	
	<xsl:template match="sqlTable/row/cell">
		<td><xsl:apply-templates/></td>
	</xsl:template>

</xsl:stylesheet>